package com.payment.web.controller.system;

import java.util.List;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.payment.common.annotation.Log;
import com.payment.common.base.AjaxResult;
import com.payment.common.enums.BusinessType;
import com.payment.common.page.TableDataInfo;
import com.payment.common.utils.ExcelUtil;
import com.payment.framework.web.base.BaseController;
import com.payment.system.domain.Remind;
import com.payment.system.service.IRemindService;

/**
 * 智能提现备注 信息操作处理
 * 
 * @author payment
 * @date 2019-12-16
 */
@Controller
@RequestMapping("/system/remind")
public class RemindController extends BaseController
{
    private String prefix = "system/remind";
	
	@Autowired
	private IRemindService remindService;
	
	@RequiresPermissions("system:remind:view")
	@GetMapping()
	public String remind()
	{
	    return prefix + "/remind";
	}
	
	/**
	 * 查询智能提现备注列表
	 */
	@RequiresPermissions("system:remind:list")
	@PostMapping("/list")
	@ResponseBody
	public TableDataInfo list(Remind remind)
	{
		startPage();
        List<Remind> list = remindService.selectRemindList(remind);
		return getDataTable(list);
	}
	
	
	/**
	 * 导出智能提现备注列表
	 */
	@RequiresPermissions("system:remind:export")
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(Remind remind)
    {
    	List<Remind> list = remindService.selectRemindList(remind);
        ExcelUtil<Remind> util = new ExcelUtil<Remind>(Remind.class);
        return util.exportExcel(list, "remind");
    }
	
	/**
	 * 新增智能提现备注
	 */
	@GetMapping("/add")
	public String add()
	{
	    return prefix + "/add";
	}
	
	/**
	 * 新增保存智能提现备注
	 */
	@RequiresPermissions("system:remind:add")
	@Log(title = "智能提现备注", businessType = BusinessType.INSERT)
	@PostMapping("/add")
	@ResponseBody
	public AjaxResult addSave(Remind remind)
	{		
		return toAjax(remindService.insertRemind(remind));
	}

	/**
	 * 修改智能提现备注
	 */
	@GetMapping("/edit/{id}")
	public String edit(@PathVariable("id") String id, ModelMap mmap)
	{
		Remind remind = remindService.selectRemindById(id);
		mmap.put("remind", remind);
	    return prefix + "/edit";
	}
	
	/**
	 * 修改保存智能提现备注
	 */
	@RequiresPermissions("system:remind:edit")
	@Log(title = "智能提现备注", businessType = BusinessType.UPDATE)
	@PostMapping("/edit")
	@ResponseBody
	public AjaxResult editSave(Remind remind)
	{		
		return toAjax(remindService.updateRemind(remind));
	}
	
	/**
	 * 删除智能提现备注
	 */
	@RequiresPermissions("system:remind:remove")
	@Log(title = "智能提现备注", businessType = BusinessType.DELETE)
	@PostMapping( "/remove")
	@ResponseBody
	public AjaxResult remove(String ids)
	{		
		return toAjax(remindService.deleteRemindByIds(ids));
	}
	
}
